package com.chenyi.pay.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 微信支付配置
 * @author wangkh
 * @date 2020/10/27 0027  16:39
 */
@Component
@ConfigurationProperties(prefix = "pay.wx")
@PropertySource(value = { "classpath:pay.yml" })
public class WxPayConfig {

    private static String appId;
    private static String webAppId;
    private static String h5AppId;
    private static String miniAppId;
    private static String mchId;
    private static String key;
    public static String returnUrl;
    public static String notifyUrl;


    public static String getAppId() {
        return appId;
    }

    @Value("${app_id}")
    public void setAppId(String appId) {
        WxPayConfig.appId = appId;
    }

    public static String getWebAppId() {
        return webAppId;
    }

    @Value("${web_app_id}")
    public static void setWebAppId(String webAppId) {
        WxPayConfig.webAppId = webAppId;
    }

    public static String getH5AppId() {
        return h5AppId;
    }

    @Value("${h5_app_id}")
    public void setH5AppId(String h5AppId) {
        WxPayConfig.h5AppId = h5AppId;
    }

    public static String getMiniAppId() {
        return miniAppId;
    }

    @Value("${miniapp_id}")
    public void setMiniAppId(String miniAppId) {
        WxPayConfig.miniAppId = miniAppId;
    }

    public static String getMchId() {
        return mchId;
    }

    @Value("${mch_id}")
    public void setMchId(String mchId) {
        WxPayConfig.mchId = mchId;
    }

    public static String getKey() {
        return key;
    }

    @Value("${key}")
    public void setKey(String key) {
        WxPayConfig.key = key;
    }

    public static String getReturnUrl() {
        return returnUrl;
    }

    @Value("${return_url}")
    public void setReturnUrl(String returnUrl) {
        WxPayConfig.returnUrl = returnUrl;
    }

    public static String getNotifyUrl() {
        return notifyUrl;
    }

    @Value("${notify_url}")
    public void setNotifyUrl(String notifyUrl) {
        WxPayConfig.notifyUrl = notifyUrl;
    }
}
